<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【节点】')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-process-add">
        <div class="col-md-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">节点名称<span style="color: red;">&nbsp;*</span>： </label>
                <div class="col-sm-9">
                    <input type="text" name="name" class="form-control" placeholder="请输入节点名称" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">x轴<span style="color: red;">&nbsp;*</span>： </label>
                <div class="col-sm-9">
                    <input type="text" name="x" class="form-control" placeholder="请输入x轴坐标" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">y轴<span style="color: red;">&nbsp;*</span>： </label>
                <div class="col-sm-9">
                    <input type="text" name="y" class="form-control" placeholder="请输入y轴坐标" required>
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">状态<span style="color: red;">&nbsp;*</span>： </label>
                    <div class="col-sm-9">
                        <label class="radio-box">
                            <input type="radio" checked="" value="1" id="optionsRadios1" name="status">正常</label>
                        <label class="radio-box">
                            <input type="radio" value="0" id="optionsRadios2" name="status">关闭</label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">来源： </label>
                <div class="col-sm-9">
                    <input type="text" name="source" class="form-control" placeholder="请输入关系的来源">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">目标： </label>
                <div class="col-sm-9">
                    <input type="text" name="target" class="form-control" placeholder="请输入关系的目标">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-9">
                    <input type="text" name="remark" class="form-control" placeholder="请输入备注" required>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "data/process"
    $("#form-process-add").validate({
        focusCleanup: true
    });


    function submitHandler() {
        if ($.validate.form()) {
            $.ajax({
                url: prefix + "/add",
                type: "post",
                dataType: "json",
                data: $('#form-process-add').serialize(),
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍候...");
                    $.modal.disable();
                },
                success: function(result) {
                    debugger;
                    if (typeof callback == "function") {
                        callback(result);
                    }
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                        parent.location.reload();
                    } else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg);
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                    $.modal.close();
                }
            });
        }
    }
</script>
</body>
</html>